<template>
  <div class="app-container">
    <!--工具栏-->
    <div class="head-container">
      <!--如果想在工具栏加入更多按钮，可以使用插槽方式， slot = 'left' or 'right'-->
      <div>
        <!-- 搜索 -->
        <el-input v-model="query.blurry" clearable size="small" placeholder="身份证，评估日期，机构编码" style="width: 370px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
        <rrOperation :crud="crud" />
      </div>
      <!--表单组件-->
      <el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="500px">
        <el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px">
          <el-form-item label="照护ID">
            <el-input v-model="form.zhid" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="姓名">
            <el-input v-model="form.xm" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="身份证">
            <el-input v-model="form.sfz" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="申请人">
            <el-input v-model="form.sqr" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="照护类别">
            <el-input v-model="form.zhlb" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="失能等级">
            <el-input v-model="form.sndj" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="是否符合">
            <el-input v-model="form.isfh" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="评估日期">
            <el-input v-model="form.pgrq" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="评估结论日期">
            <el-input v-model="form.pgjl" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="评估人">
            <el-input v-model="form.pgr" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="机构编码">
            <el-input v-model="form.jgbm" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="是否打印">
            <el-input v-model="form.isprint" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="C01">
            <el-input v-model="form.c01" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="C02">
            <el-input v-model="form.c02" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="C03">
            <el-input v-model="form.c03" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="C04">
            <el-input v-model="form.c04" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="C05">
            <el-input v-model="form.c05" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="C06">
            <el-input v-model="form.c06" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="C07">
            <el-input v-model="form.c07" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="C08">
            <el-input v-model="form.c08" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="C09">
            <el-input v-model="form.c09" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="C10">
            <el-input v-model="form.c10" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="C1">
            <el-input v-model="form.c1" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="C11">
            <el-input v-model="form.c11" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="C12">
            <el-input v-model="form.c12" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="C13">
            <el-input v-model="form.c13" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="C14">
            <el-input v-model="form.c14" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="C2">
            <el-input v-model="form.c2" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="C15">
            <el-input v-model="form.c15" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="C16">
            <el-input v-model="form.c16" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="C17">
            <el-input v-model="form.c17" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="C3">
            <el-input v-model="form.c3" style="width: 370px;" />
          </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
          <el-button @click="crud.cancelCU">取消</el-button>
          <el-button :loading="crud.status.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
        </div>
      </el-dialog>
      <!--表格渲染-->
      <el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
        <el-table-column type="selection" width="55" />
        <el-table-column prop="xm" label="姓名" />
        <el-table-column prop="sfz" label="身份证" />
        <el-table-column prop="sqr" label="申请人" />
        <el-table-column prop="sndj" label="失能等级" />
        <el-table-column prop="isfh" label="是否符合" />
        <el-table-column prop="pgrq" label="评估日期" />
        <el-table-column prop="pgjl" label="评估结论日期" />
        <el-table-column prop="pgr" label="评估人" />
        <el-table-column prop="jgbm" label="机构编码" />
        <el-table-column prop="c1" label="C1" />
        <el-table-column prop="c2" label="C2" />
        <el-table-column prop="c3" label="C3" />
        <el-table-column fixed="right" label="操作" width="150px" align="center">
          <template slot-scope="scope">
            <el-button
              type="primary"
              size="small"
              icon="el-icon-download"
              @click.native.prevent="recall(scope.row)"
            /></template>
        </el-table-column>
      </el-table>
      <!--分页组件-->
      <pagination />
    </div>
  </div>
</template>

<script>
import crudPgjl from '@/api/business/pgjl'
import CRUD, { presenter, header, form, crud } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import pagination from '@crud/Pagination'

const defaultForm = { bisPgjlId: null, zhid: null, xm: null, sfz: null, sqr: null, zhlb: null, sndj: null, isfh: null, pgrq: null, pgjl: null, pgr: null, jgbm: null, isprint: null, c01: null, c02: null, c03: null, c04: null, c05: null, c06: null, c07: null, c08: null, c09: null, c10: null, c1: null, c11: null, c12: null, c13: null, c14: null, c2: null, c15: null, c16: null, c17: null, c3: null }
export default {
  name: 'Pgjl',
  components: { pagination, rrOperation },
  mixins: [presenter(), header(), form(defaultForm), crud()],
  cruds() {
    return CRUD({ title: '评估结论', url: 'api/pgjl', idField: 'bisPgjlId', sort: 'bisPgjlId,desc', crudMethod: { ...crudPgjl }})
  },
  data() {
    return {
      permission: {
        add: ['admin', 'pgjl:add'],
        edit: ['admin', 'pgjl:edit'],
        del: ['admin', 'pgjl:del']
      },
      rules: {
      }}
  },
  methods: {
    // 钩子：在获取表格数据之前执行，false 则代表不获取数据
    [CRUD.HOOK.beforeRefresh]() {
      return true
    },

    /**
     * 撤回
     * @param index
     * @param rows
     */
    recall(index, rows) {
      this.crud.toEdit(rows)
    }
  }
}
</script>

<style scoped>

</style>
